package com.tcm.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.tcm.entity.User;
import com.tcm.entity.dto.param.StuUserInfoUpdateParam;
import com.tcm.entity.dto.param.UserAdminInsertParam;
import com.tcm.entity.dto.param.UserAdminUpdateParam;
import com.tcm.entity.dto.param.UserInfoUpdateParam;
import com.tcm.entity.resp.PageR;
import com.tcm.entity.vo.StuUserInfoResult;
import com.tcm.entity.vo.UserInfoResult;
import com.tcm.entity.vo.UserListResult;
import com.tcm.exception.DatabaseOperationException;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Map;

/**
 * 用户业务接口
 * @author Guqier
 * @version 1.0
 * @date 2023/7/1 22:37
 */
public interface UserService extends IService<User> {

    /**
     * 获取用户信息
     * @param currUserId 当前用户ID
     * @return 用户信息
     */
    UserInfoResult getUserInfo(Long currUserId);

    User getUserByAccount(String account);

    User getNewFillInfoUser(String account, String name, String nickname, int type, int gender, String email, String phone, Long currUserId);

    @Transactional
    boolean addAdminUser(UserAdminInsertParam adminUpdateParam, Long currUserId) throws DatabaseOperationException;

    PageR<UserListResult> getAdminUserListByPage(Integer pageNum, Integer pageSize, String account, String name);

    boolean modifyAdminUserInfo(UserAdminUpdateParam param, Long currUserId);

    @Transactional
    boolean removeAdminUser(List<String> ids, Long currUserId);

    PageR<UserListResult> getUserListByPage(Integer pageNum, Integer pageSize, String account, String name, Integer type);

    String resetUserPassword(Long id, Long currUserId);

    boolean modifyUserInfoSelf(UserInfoUpdateParam param, Long currUserId) throws Exception;

    boolean modifyUserPasswordSelf(String oldPassword, String newPassword, Long currUserId);

    StuUserInfoResult getStuUserInfo(Long currUserId);

    @Transactional
    Map<String, String> updateStuAvatar(MultipartFile file, Long currUserId) throws Exception;

    boolean modifyStuUserInfoSelf(StuUserInfoUpdateParam param, Long currUserId);
}
